#include "initialize_matrix_improved.hpp"

using namespace std;
vector < vector<int> > initialize_matrix_improved(int num_rows, int num_cols, int initial_value) {
    
    vector < vector<int> > matrix;
    vector<int> new_row;
    
    for (int j = 0; j < num_cols; j++) {
        new_row.push_back(initial_value);
    }
    
    for (int i = 0; i < num_rows; i++) {
        /*
         * 此处的push_back的值与Python中的引用不一样,这不是引用,
         * 而是new_row的值保存在matrix的新开辟的内存当中
         */
        matrix.push_back(new_row);

    }
    

    return matrix;
}
